Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test to check missing fields in cpe_helper file #3766

Merged
merged 9 commits into from
Feb 2, 2023

Conversation

fedepacher
Copy link
Contributor

@fedepacher fedepacher commented Jan 17, 2023

Related issue
#798

Description

This PR aims to add tests to check if cpe_helper.json dictionary works correctly when there are missing fields.

Added

  • custom_generic_cpe_helper_one_package.json
  • custom_vulnerable_pkg_missing_vendor_version.json
  • custom_vulnerable_pkg_missing_vendor.json
  • configuration_cpe_indexing.yaml
  • cases_cpe_indexing_missing_fields.yaml
  • cases_cpe_indexing_vendor_version.yaml
  • test_cpe_helper_missing_fields.py

Testing performed

Tester Test path Jenkins Local OS Commit Notes
@fedepacher (Developer) 🟢 ⚫⚫⚫ Nothing to highlight
@Rebits (Reviewer) ⚫⚫⚫ ⚫⚫⚫ Nothing to highlight

@jmv74211 jmv74211 changed the base branch from master to 4.5 February 1, 2023 10:20
Copy link
Contributor

@jmv74211 jmv74211 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

=============================================================================================== test session starts ===============================================================================================
platform linux -- Python 3.9.7, pytest-6.2.3, py-1.10.0, pluggy-0.13.1 -- /usr/bin/python3
cachedir: .pytest_cache
metadata: {'Python': '3.9.7', 'Platform': 'Linux-5.4.0-86-generic-x86_64-with-glibc2.31', 'Packages': {'pytest': '6.2.3', 'py': '1.10.0', 'pluggy': '0.13.1'}, 'Plugins': {'metadata': '1.11.0', 'html': '3.1.1', 'testinfra': '5.0.0'}}
rootdir: /home/vagrant/wazuh-qa/tests/integration, configfile: pytest.ini
plugins: metadata-1.11.0, html-3.1.1, testinfra-5.0.0
collected 26 items                                                                                                                                                                                                

test_vulnerability_detector/test_cpe_helper/test_cpe_helper.py::test_cpe_indexing_wrong_tags[Wrong source vendor fields] PASSED                                                                             [  3%]
test_vulnerability_detector/test_cpe_helper/test_cpe_helper.py::test_cpe_indexing_wrong_tags[Wrong translation product fields] PASSED                                                                       [  7%]
test_vulnerability_detector/test_cpe_helper/test_cpe_helper.py::test_cpe_indexing_wrong_tags[Wrong version field] PASSED                                                                                    [ 11%]
test_vulnerability_detector/test_cpe_helper/test_cpe_helper.py::test_cpe_indexing_wrong_tags[Wrong format_version fields] PASSED                                                                            [ 15%]
test_vulnerability_detector/test_cpe_helper/test_cpe_helper.py::test_cpe_indexing_wrong_tags[Wrong update_date fields] PASSED                                                                               [ 19%]
test_vulnerability_detector/test_cpe_helper/test_cpe_helper.py::test_cpe_indexing_wrong_tags[Wrong target field] PASSED                                                                                     [ 23%]
test_vulnerability_detector/test_cpe_helper/test_cpe_helper.py::test_cpe_indexing_wrong_values[Wrong version value] PASSED                                                                                  [ 26%]
test_vulnerability_detector/test_cpe_helper/test_cpe_helper.py::test_cpe_indexing_wrong_values[Wrong update_date value] PASSED                                                                              [ 30%]
test_vulnerability_detector/test_cpe_helper/test_cpe_helper.py::test_cpe_indexing_wrong_values[Wrong target value] PASSED                                                                                   [ 34%]
test_vulnerability_detector/test_cpe_helper/test_cpe_helper.py::test_cpe_indexing_wrong_values[Wrong format_version value] PASSED                                                                           [ 38%]
test_vulnerability_detector/test_cpe_helper/test_cpe_helper.py::test_cpe_indexing_wrong_values[Wrong source vendor value] PASSED                                                                            [ 42%]
test_vulnerability_detector/test_cpe_helper/test_cpe_helper.py::test_cpe_indexing_wrong_values[Wrong source product value] PASSED                                                                           [ 46%]
test_vulnerability_detector/test_cpe_helper/test_cpe_helper.py::test_cpe_indexing_wrong_values[Wrong action value] PASSED                                                                                   [ 50%]
test_vulnerability_detector/test_cpe_helper/test_cpe_helper.py::test_cpe_indexing_missing_field[Missing version field] PASSED                                                                               [ 53%]
test_vulnerability_detector/test_cpe_helper/test_cpe_helper.py::test_cpe_indexing_missing_field[Missing format_version field] PASSED                                                                        [ 57%]
test_vulnerability_detector/test_cpe_helper/test_cpe_helper.py::test_cpe_indexing_missing_field[Missing update_date field] PASSED                                                                           [ 61%]
test_vulnerability_detector/test_cpe_helper/test_cpe_helper.py::test_cpe_indexing_missing_field[Missing target field] PASSED                                                                                [ 65%]
test_vulnerability_detector/test_cpe_helper/test_cpe_helper.py::test_cpe_indexing_missing_field[Missing action field] PASSED                                                                                [ 69%]
test_vulnerability_detector/test_cpe_helper/test_cpe_helper.py::test_cpe_indexing_missing_field[Missing vendor field] PASSED                                                                                [ 73%]
test_vulnerability_detector/test_cpe_helper/test_cpe_helper.py::test_cpe_indexing_missing_field[Missing product field] PASSED                                                                               [ 76%]
test_vulnerability_detector/test_cpe_helper/test_cpe_helper.py::test_cpe_indexing_empty_fields[Missing vendor field] PASSED                                                                                 [ 80%]
test_vulnerability_detector/test_cpe_helper/test_cpe_helper.py::test_cpe_indexing_empty_fields[Missing vendor and version fields] PASSED                                                                    [ 84%]
test_vulnerability_detector/test_cpe_helper/test_cpe_helper.py::test_cpe_indexing_empty_fields[Missing set_version_if_product_matches action field] PASSED                                                  [ 88%]
test_vulnerability_detector/test_cpe_helper/test_cpe_helper.py::test_cpe_indexing_empty_fields[Replace_vendor instead of set_version_if_product_matches action fields] PASSED                               [ 92%]
test_vulnerability_detector/test_cpe_helper/test_cpe_helper.py::test_cpe_indexing_empty_fields[Missing all source fields] PASSED                                                                            [ 96%]
test_vulnerability_detector/test_cpe_helper/test_cpe_helper.py::test_cpe_indexing_empty_vendor_version[Missing all the source fields and version translation field] PASSED                                  [100%]

========================================================================================= 26 passed in 815.79s (0:13:35) ==========================================================================================

@jmv74211 jmv74211 merged commit 86eabe7 into 4.5 Feb 2, 2023
@jmv74211 jmv74211 deleted the 798-update-cpe-helper branch February 2, 2023 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants